
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="distributorSales.do"/>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager,java.util.Calendar,
                        com.scalar.chiptrack.utils.StringUtils"%>
<%@ page import="com.scalar.chiptrack.commons.Constants" %>
<%@ page import="com.scalar.chiptrack.users.Functionality" %>
<%@ page import="com.scalar.chiptrack.users.User" %>
<%
    String chipTracContext  = "/" + ConfigManager.getChipTracContext();
    String userTypeChiptrac = Constants.USER_TYPE_CHIPTRAC + "";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>

<SCRIPT language="JavaScript">

var dateElement = "";
function openCalendar( dateValue )
{
    dateElement = dateValue;
    newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
    newWindow.focus();
}

function assignDate( passedValue )
{
    dateElement.value=passedValue;
    window.focus();
}

function calculateExtendedPrice(i)
{
    var form = document.distributorSalesForm;
    var numberOfLineItems   = form.noOflineItems;
    var shippedQty          = form[ 'lineItemList['+ i +'].qtyShip'].value;
	var extCostCrtl         = form[ 'lineItemList['+ i +'].extCost'];
	var unitCostCrtl        = form[ 'lineItemList['+ i +'].unitCost'];
    var extendedPrice       = 0.0;

    if( shippedQty > 0 )
    {
        extendedPrice = parseFloat( shippedQty ) * parseFloat( unitCostCrtl.value );
    }
    //alert( typeof( extendedPrice ) )

    if( extendedPrice > 0.0 )
    {
        extCostCrtl.value = extendedPrice;
    }
    else
    {
        extCostCrtl.value = 0.0;    
    }
}
function calculateExtendedSalePrice(i)
{
    var form = document.distributorSalesForm;
    var numberOfLineItems   = form.noOflineItems;
    var shippedQty          = form[ 'lineItemList['+ i +'].qtyShip'].value;
	var extSalePriceCrtl         = form[ 'lineItemList['+ i +'].extReSalePrice'];
	var salePriceCrtl        = form[ 'lineItemList['+ i +'].reSalePrice'];
    var extendedPrice       = 0.0;

    if( shippedQty > 0 )
    {
        extendedPrice = parseFloat( shippedQty ) * parseFloat( salePriceCrtl.value );
    }
    //alert( typeof( extendedPrice ) )

    if( extendedPrice > 0.0 )
    {
        extSalePriceCrtl.value = extendedPrice;
    }
    else
    {
        extSalePriceCrtl.value = 0.0;
    }
}

function addmore()
{
    var form    = document.distributorSalesForm;
    var numberOfLineItems = form.noOflineItems;
    if( typeof( numberOfLineItems.length ) == "undefined" )
    {
        form['lineItemList[0].lineItemNo'].disabled = false;
        form['lineItemList[0].qtyShip'].disabled = false;
        form['lineItemList[0].extCost'].disabled = false;
        form['lineItemList[0].extReSalePrice'].disabled = false;
        //form['lineItemList[0].cancel'].disabled = false;
    }
    else
    {
        for( var i = 0; i < numberOfLineItems.length; i++ )
        {
            form['lineItemList[' + i + '].lineItemNo'].disabled = false;
            form['lineItemList[' + i + '].qtyShip'].disabled = false;
            form['lineItemList[' + i + '].extCost'].disabled = false;
            form['lineItemList[' + i + '].extReSalePrice'].disabled = false;
            //form['lineItemList[' + i + '].cancel'].disabled = false;
        }
    }
    document.distributorSalesForm.action = '<%=chipTracContext%>/distributorSales.do?action=addmore';
	document.distributorSalesForm.submit();
}

function searchDistributorSales()
{
    return true;
}

function generateDistributorSales()
{
    document.distributorSalesForm.action = '<%=chipTracContext%>/distributorSales.do?action=create';
    document.distributorSalesForm.submit();
}
function loadEndCustomers()
{
    document.distributorSalesForm.action = '<%=chipTracContext%>/distributorSales.do?action=loadEndCustomers';
    document.distributorSalesForm.submit();
}
function loadNewEndCustomer()
{
    var form = document.distributorSalesForm;
    var endCustomerCtrl = form.customer_Id;
    var endCustomerNameCtrl = form.newEndCustomerName;
    var endCustomerLabelSpan = document.getElementById ( "endCustomerLabelSpan" );
    var endCustomerTxfieldSpan = document.getElementById ( "endCustomerTxfieldSpan" );
    if ( endCustomerCtrl.value == "-2" )
    {
        endCustomerLabelSpan.style.display = 'block';
        endCustomerTxfieldSpan.style.display = 'block';
    }
    else
    {
        endCustomerNameCtrl.value = "";
        endCustomerLabelSpan.style.display = 'none';
        endCustomerTxfieldSpan.style.display = 'none';
    }
}

function openInventoryNew ( i )
{
    var msg;
	var finalInventoryURL;
    var form = document.distributorSalesForm;
    var errors = "";
    var pa=document.getElementById("errors");

    var productId 		= form[ 'lineItemList['+ i +'].productId' ].value;
    var lineItemNo		= form[ 'lineItemList['+ i +'].lineItemNo'].value;
	var requestedQty    = form[ 'lineItemList['+ i +'].qty_req'].value;
	var shippedQty    = form[ 'lineItemList['+ i +'].qtyShip'].value;
	var distributorId   = form.distributorId.value;
    var distSalesOrderId= form.distSalesOrderId.value;
    if( distributorId == 0 )
    {
        errors = errors + "<li>Please Select the Distributor Name";
    }
    if( productId == "" )
    {
        errors = errors + "<li>Please Select the Part Number of Line Item no: " + lineItemNo ;
    }
    /*if( requestedQty == "" || requestedQty == 0 )
    {
        errors = errors + "<li>Please Enter the Requested Qty for Line Item no: " + lineItemNo ;
    }*/

    if( errors != "" )
    {
        pa.innerHTML = errors;
        return;
    }
    else
    {
        pa.innerHTML = errors;
        finalInventoryURL = '<%=chipTracContext%>/distributorInventory.do?action=search&productId=' + productId + '&lineItemNo=' + lineItemNo + '&requestedQty=' + requestedQty+ '&distributorId=' + distributorId + ' &distSalesOrderId='+ distSalesOrderId +' &controlIndex=' + i;

        var leftPos=(screen.width)?(screen.width-675)/2:100;
        var topPos=(screen.height)?(screen.height-450)/2:100;

        newWindow = window.open (finalInventoryURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=760,height=470,resizable=yes,Left= '+leftPos+',top='+topPos);
        newWindow.focus();
    }

}

function submitLotDetails()
{
    var form    = document.distributorSalesForm;
    var errors  = "";
    var pa=document.getElementById("errors");

    var productId;
    var lineItemNo;
	var requestedQty;
    var quantityShip;
    var requestDate;
    var shipDate;
    var distributorId   = form.distributorId.value;
    var customerId      = form.customer_Id.value;
    var salesOrderNo    = form.salesOrderNo.value;

    var numberOfLineItems = form.noOflineItems;

    if( distributorId == 0 )
    {
        errors = errors + "<li>Please Select the Distributor Name";
    }
    if( customerId == 0 )
    {
        errors = errors + "<li>Please Select the Customer Name";
    }
    if( salesOrderNo == "" )
    {
        errors = errors + "<li>Please Enter Sales Order #";
    }
    if( typeof( numberOfLineItems.length ) == "undefined" )
    {
        productId 		= form[ 'lineItemList[0].productId' ].value;
        lineItemNo		= form[ 'lineItemList[0].lineItemNo'].value;
        //requestedQty    = form[ 'lineItemList[0].qty_req'].value;
        quantityShip    = parseInt(form[ 'lineItemList[0].qtyShip'].value);
        //requestDate     = form[ 'lineItemList[0].req_date'].value;
        shipDate     = form[ 'lineItemList[0].shipDate'].value;

        if( productId == "" )
        {
            errors = errors + "<li>No Line Item details are found, Please select for atleast one Line Item Product";
        }
        /*if( productId != "" && requestedQty == "" || requestedQty == 0 )
        {
            errors = errors + "<li> Please Enter the Requested Qty for Line Item no: " + lineItemNo ;
        }*/
        if( productId != "" && shipDate == "" )
        {
            errors = errors + "<li> Please Enter the Ship Date for Line Item no: " + lineItemNo ;
        }
        if( productId != "" && ( quantityShip == "" || quantityShip == 0 ) )
        {
            errors = errors + "<li> Please Enter the Shipped Qty for Line Item no: " + lineItemNo ;
        }
        form[ 'lineItemList[0].qty_req'].value = quantityShip;
        form[ 'lineItemList[0].req_date'].value = shipDate;
    }
    else
    {
        var atLeastOneLineItemCount = 0;
        for( var i = 0; i < numberOfLineItems.length; i++ )
        {
            productId = form[ 'lineItemList['+ i +'].productId' ].value;
            if( productId == "" )
            {
                atLeastOneLineItemCount++;
            }
        }
        if( atLeastOneLineItemCount == numberOfLineItems.length )
        {
            errors = errors + "<li>No Line Item details are found, Please select for atleast one Line Item Product";
        }
        else
        {
            for( var i = 0; i < numberOfLineItems.length; i++ )
            {
                productId 		= form[ 'lineItemList['+ i +'].productId' ].value;
                lineItemNo		= form[ 'lineItemList['+ i +'].lineItemNo'].value;
                //requestedQty    = form[ 'lineItemList['+ i +'].qty_req'].value;
                quantityShip    = parseInt(form[ 'lineItemList['+ i +'].qtyShip'].value);
                //requestDate     = form[ 'lineItemList['+ i +'].req_date'].value;
                shipDate        = form[ 'lineItemList['+ i +'].shipDate'].value;

                /*if( productId != "" && ( requestedQty == "" || requestedQty == 0 ) )
                {
                    errors = errors + "<li> Please Enter the Requested Qty for Line Item no: " + lineItemNo ;
                    break;
                }
                if( productId != "" && requestDate == "" )
                {
                    errors = errors + "<li> Please Enter the Requested Date for Line Item no: " + lineItemNo ;
                    break;
                } */
                if( productId != "" && shipDate == "" )
                {
                    errors = errors + "<li> Please Enter the Ship Date for Line Item no: " + lineItemNo ;
                    break;
                }
                if( productId != "" && ( quantityShip == "" || quantityShip == 0 ) )
                {
                    errors = errors + "<li> Please Enter the Shipped Qty for Line Item no: " + lineItemNo ;
                    break;
                }
                form[ 'lineItemList['+ i +'].req_date'].value = shipDate;
                form[ 'lineItemList['+ i +'].qty_req'].value = quantityShip;
            }
        }
    }

    if( errors != "" )
    {
        pa.innerHTML = errors;
        return;
    }
    else
    {

        if( typeof( numberOfLineItems.length ) == "undefined" )
        {
            form['lineItemList[0].lineItemNo'].disabled = false;
            form[ 'lineItemList[0].qty_req'].disabled = false;
            form[ 'lineItemList[0].req_date'].disabled = false;
            form['lineItemList[0].qtyShip'].disabled = false;
            form['lineItemList[0].extCost'].disabled = false;
            form['lineItemList[0].extReSalePrice'].disabled = false;


        }
        else
        {
            for( var i = 0; i < numberOfLineItems.length; i++ )
            {
                form['lineItemList[' + i + '].lineItemNo'].disabled = false;
                form[ 'lineItemList['+ i +'].qty_req'].disabled = false;
                form[ 'lineItemList['+ i +'].req_date'].disabled = false;
                form['lineItemList[' + i + '].qtyShip'].disabled = false;
                form['lineItemList[' + i + '].extCost'].disabled = false;
                form['lineItemList[' + i + '].extReSalePrice'].disabled = false;
            }
        }

        form.action='<%=chipTracContext%>/distributorSales.do?action=save';
        form.submit();
        //return true;
    }
}

function onLoad()
{
    var form                = document.distributorSalesForm;
    var numberOfLineItems   = form.noOflineItems;

    if( typeof( numberOfLineItems.length ) == "undefined" )
    {
        if( form['lineItemList[0].productId'].value == "" )
        {
           form['lineItemList[0].productId'].selectedIndex = 0;
        }
    }
    else
    {
        for( var i = 0; i < numberOfLineItems.length; i++ )
        {
            if( form['lineItemList[' + i + '].productId'].value == "" )
            {
                form['lineItemList[' + i + '].productId'].selectedIndex = 0;
            }
        }
    }
   loadNewEndCustomer(); 
}
</SCRIPT>
</HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" onLoad="javascript:onLoad();">
<!-- Top Header Start-->

<%@ include file="/jsp/includes/header.jsp" %>

<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
	<TBODY>
	<TR>
		<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
            <%--<%@ include file="/jsp/operations/operations_menu.jsp" %>--%>
            <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
                <%@ include file="/jsp/operations/operations_menu.jsp" %>
            </logic:equal>
            <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
                <%@ include file="/jsp/admin/externaluser_menu.jsp" %>
            </logic:notEqual>
            <!-- end of the side navigations -->
		</td>
		<td bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=10></td>
		<td valign="top" width="100%">
			<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0><BR>
            <!-- from here your body starts -->
			<%--<html:form name="distributorSalesForm" method="post" action="/distributorSales" type="com.scalar.chiptrack.operations.distributor.forms.DistributorSalesForm" onsubmit="javascript:return searchDistributorSales();" >--%>
			<html:form name="distributorSalesForm" method="post" action="/distributorSales" type="com.scalar.chiptrack.operations.distributor.forms.DistributorSalesForm">
			<table border="0" width="100%" align=right >
                <tr>
					<td><center><span class="NArialW">Distributor Sales</span></center><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td>
                </tr>
                <logic:equal name="showMessage" value="TRUE">
                <tr><td align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b></font></td></tr>
                </logic:equal>
                <tr>
					<td>
						<table border="0" width="80%" align=right>
                            <tr><td colspan=5 class="NArialL" align="left"><font color="FF0000"><FONT id="errors"></FONT></font></td></tr>
                            <tr><td colspan=5 id="svrErrors"><chiptrack:errors styleClass="NArialL"/></td></tr>
                            <tr><td colspan=5 id="svrInfo"><chiptrack:info styleClass="NArialL"/></td></tr>
                            <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                            <tr>
                                <html:hidden name="distributorSalesForm" property="distSalesOrderId" />
                                <td width="15%" class="NArialL" align="right">Distributor Name<font color="RED" size="1"><B>*</B></font></td>
                                <td width="20%" class="NArialL">
                                    <html:select name="distributorSalesForm"  property="distributorId" styleClass="txfield" onchange="javascript:loadEndCustomers();">
                                        <html:option value="0">--Select Distributor--</html:option>
                                        <html:options collection="distributorList" property="value" labelProperty="label"/>
                                    </html:select>
                                </td>
                                <td width="10%">&nbsp;</td>
                                <td width="15%" class="NArialL"><bean:message key="label.sales.shipToCustomer"/><font color="RED" size="1"><B>*</B></font></td>
                                <td width="20%">
                                    <html:select name="distributorSalesForm"  property="customer_Id" styleClass="txfield" onchange="javascript:loadNewEndCustomer();">
                                        <html:option value="0">--Select <bean:message key="label.sales.shipToCustomer"/>--</html:option>
                                        <%--<html:options collection="customerList" property="value" labelProperty="label"/>--%>
                                        <html:options collection="endCustomerList" property="value" labelProperty="label"/>
                                        <html:option value="-2" >-----Add New-----</html:option>
                                    </html:select>
                                </td>
                            </tr>
                            <tr>
                                <td width="15%" class="NArialL">&nbsp;</td>
                                <td width="20%" class="NArialL">&nbsp;</td>
                                <td width="5%">&nbsp;</td>
                                <td width="15%" class="NArialL"><span id="endCustomerLabelSpan" style="display:none">Add New <bean:message key="label.sales.shipToCustomer"/><font color="RED" size="1"><B>*</B></font></span></td>
                                <td width="20%"><span id="endCustomerTxfieldSpan" style="display:none"><html:text name="distributorSalesForm" property="newEndCustomerName" styleClass="txfield"/></span></td>
                            </tr>
                            <tr>
                                <td class="NArialL" align="right">Sales Order#<font color="RED" size="1"><B>*</B></font></td>
                                <td class="NArialL">
                                    <html:text name="distributorSalesForm" property="salesOrderNo" styleClass="txfield" disabled="true"/>
                                </td>
                                <td>&nbsp;</td>
                                <td class="NArialL">Customer PO</td>
                                <td class="NArialL">
                                   <html:text name="distributorSalesForm" property="customerPO" styleClass="txfield"/>
                                </td>
                            </tr>

                            <tr>
                                <td class="NArialL" align="right">Sales Order Date<font color="RED" size="1"><B>*</B></font></td>
                                <td class="NArialL">
                                    <html:text name="distributorSalesForm" property="salesOrderDate" styleClass="txfield"/>
                                    <a href="javascript:openCalendar( document.distributorSalesForm.salesOrderDate )">
                                        <img onMouseOver="window.status='Click to select date';return true" onMouseout="window.status='';return 	true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20>
                                    </a>
                                </td>
                                <td>&nbsp;</td>
                                <td class="NArialL">&nbsp;</td>
                                <td class="NArialL">&nbsp;</td>
                            </tr>

                            <tr><td colspan='5'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                            <tr>
                                <td colspan='5' >
                                    <table border="0" width="100%" align="Center">
                                        <tr><td colspan='10' align="left" class="NArialL">Line Item Details:</td></tr>
                                        <tr align="left">
                                            <td width="4%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Record No</font></td>
                                            <td width="4%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF"><bean:message key="label.sales.distributor.userField1"/></font></td>
                                            <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Part Number<font color="RED" size="1"><B>*</B></font></font></td>
                                            <td width="8%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Req Qty<%--<font color="RED" size="1"><B>*</B></font>--%></font></td>
                                            <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Req Date<%--<font color="RED" size="1"><B>*</B></font>--%></font></td>
                                            <td width="12%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Shipped Qty<font color="RED" size="1"><B>*</B></font></font></td>
                                            <td width="12%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Ship Date<font color="RED" size="1"><B>*</B></font></font></td>
                                            <td width="8%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Unit Cost</font></td>
                                            <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Ext Cost</font></td>
                                            <td width="8%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">ReSale Price<font color="RED" size="1"><B>*</B></font></font></td>
                                            <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Ext ReSale Price</font></td>
                                            <%--<td width="10%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Is Cancel</font></font></td>--%>
                                        </tr>
                                        <nested:iterate id="lineitem" property="lineItemList" type="com.scalar.chiptrack.operations.distributor.DistLineItem" indexId="lineItemIdx">
                                        <% int lineItemNoIdx = lineItemIdx.intValue() + 1; %>
                                        <%
                                                    String reqTemp  = "document.distributorSalesForm['lineItemList["+ lineItemIdx.intValue() +"].req_date']";
                                                    String shipTemp = "document.distributorSalesForm['lineItemList["+ lineItemIdx.intValue() +"].shipDate']";
                                                    String extCost  = "calculateExtendedPrice("+ lineItemIdx.intValue() +")";
                                                    String extSalePrice  = "calculateExtendedSalePrice("+ lineItemIdx.intValue() +")";
                                        %>
                                        <tr>
                                            <nested:hidden property="lineItem_Id"/>
                                            <input type="hidden" name="noOflineItems"/>
                                            <td>
                                                <nested:equal property="lineItemNo" value="-1">
                                                    <nested:text property="lineItemNo" size="2" maxlength="2" styleClass="txfield" value='<%=lineItemNoIdx+""%>' disabled="true"/>
                                                    <%--<nested:hidden property="lineItemNo" value='<%=lineItemNoIdx+""%>'/>--%>
                                                </nested:equal>
                                                <nested:notEqual property="lineItemNo" value="-1">
                                                    <nested:text property="lineItemNo" size="2" maxlength="2" styleClass="txfield" disabled="true"/>
                                                    <%--<nested:hidden property="lineItemNo"/>--%>
                                                </nested:notEqual>
                                            </td>
                                            <td><nested:text property="userDefinedField1" size="4" maxlength="10" styleClass="txfield"/></td>
                                            <td>
                                                <nested:select property="productId"  styleClass="txfield">
                                                     <html:options collection="productList" property="value" labelProperty="label" />
                                                </nested:select>
                                            </td>
                                            <td><nested:text property="qty_req" size="8" maxlength="10" styleClass="txfield" disabled="true"/></td>
                                            <td nowrap>
                                                <nested:text property="req_date" size="10" maxlength="10"  styleClass="txfield" disabled="true"/>
                                                <a href="javascript:openCalendar(<%=reqTemp%>)"><img onMouseOver="window.status='Click to select date';return true" onMouseout="window.status='';return true" border="0" src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                                            </td>
                                            <td nowrap>
                                                <nested:text property="qtyShip" styleClass="txfield" disabled="true" size="8" maxlength="10" />
                                                <A href="javascript:openInventoryNew('<%=lineItemIdx%>');" onMouseOver="window.status='Click here to see the FG Inventory';return true" onMouseOut="window.status='';return true"><img border='0' alt="Click here to select inventory" height='12' width='16' src="<%=chipTracContext%>/jsp/includes/images/arrow.gif"></A>
                                            </td>
                                            <td nowrap>
                                                <nested:text property="shipDate" size="10" maxlength="10" styleClass="txfield"/>
                                                <a href="javascript:openCalendar(<%=shipTemp%>)"><img onMouseOver="window.status='Click to select date';return true" onMouseout="window.status='';return true" border="0" src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                                            </td>
                                            <td><nested:text property="unitCost" styleClass="txfield"  size="8" maxlength="10" onkeypress="javascript:amountFieldKeyPress(this)" onkeyup="<%=extCost%>" /></td>
                                            <td><nested:text property="extCost" styleClass="txfield"  size="10" maxlength="10" disabled="true" />
                                            <%--<nested:hidden property="status" value=""/>--%>
                                            </td>
                                            <%--<nested:notEqual property="status" value="cancel">
                                            <td><nested:checkbox property="cancel" styleClass="txfield"   disabled="false" /></td>
                                            </nested:notEqual>
                                            <nested:equal property="status" value="cancel">
                                             <td><nested:checkbox property="cancel" styleClass="txfield"   disabled="true" /></td>
                                             </nested:equal>
--%>                                        <td><nested:text property="reSalePrice" styleClass="txfield"  size="8" maxlength="10" onkeypress="javascript:amountFieldKeyPress(this)" onkeyup="<%=extSalePrice%>" /></td>
                                            <td><nested:text property="extReSalePrice" styleClass="txfield"  size="10" maxlength="10" disabled="true" />
                                        </tr>
                                        </nested:iterate>
                                    </table>
                                </td>
                            </tr>
						<tr><td colspan='5'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
						<tr><td colspan='4'>&nbsp;</td>
                            <td colspan='1' align='center'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <a href="javascript:addmore();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/addmore.gif" width="53" height="17"></a></td></tr>
						<tr><td colspan='5'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
						<tr>
							<td colspan="5" align="center">
                                <chiptrack:restrictedLink functionality='<%=Functionality.DISTRIBUTOR_SALES_ORDER %>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:submitLotDetails();' onmouseover="window.status='Click to Save Distributor Sales Details';return true" onmouseout="window.status='';return true">
                                    <img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" title="Click to Save Distributor Sales Details"/>
                                </chiptrack:restrictedLink>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <a href="javascript:document.distributorSalesForm.reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
							</td>
						</tr>
						</table>
					</td>
				</tr>
			</table>
			</html:form>
<!-- body ends here -->
		</td>
	</tr>
	</tbody>
</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->

</BODY>
</HTML>
